import { IS_LOGIN, SET_USER_DATA } from "./action";

const initState = {
  isLogin: false, //是否登录
  isRender: false, // 第一次检查是否初始化
  userData: {}
};

const HomeRuducer = (state = initState, { type, ...payload }) => {
  switch (type) {
    case IS_LOGIN: {
      return {
        ...state,
        isLogin: payload.isLogin,
        isRender: payload.isRender
      };
    }
    case SET_USER_DATA: {
      return {
        ...state,
        userData: payload.userData
      }
    }
    default: {
      return state;
    }
  }
};

export default HomeRuducer;
